<?php

namespace App\Common\Traits\Model;

trait DepartmentSearchTrait
{

    //
    public function departmentSearch($request,$model){
        if($request->filled('department_name')){
            $model=$model->where(function ($query) use($request){
                $query->where('department1',$request->department_name)
                    ->orWhere('department2',$request->department_name)
                    ->orWhere('department3',$request->department_name);
            });
        }
        return $model;
    }


}
